dbus_interfaces = [
+ 'org.gnome.Shell.Brightness.xml',
'org.gnome.Shell.Extensions.xml',
'org.gnome.Shell.Introspect.xml',
'org.gnome.Shell.PadOsd.xml',
--- /dev/null
+<!DOCTYPE node PUBLIC
+'-//freedesktop//DTD D-BUS Object Introspection 1.0//EN'
+'http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd'>
+<!--
+ SPDX-License-Identifier: GPL-3.0-or-later
+-->
+<node>
+
+ <!--
+ org.gnome.Shell.Brightness:
+ @short_description: Brightness interface
+
+ The interface used to give the shell brightness related information.
+ -->
+ <interface name="org.gnome.Shell.Brightness">
+
+ <!--
+ SetDimming:
+ @enable: whether to enabled dimming
+
+ Enable or disable screen dimming to save power.
+ -->
+ <method name="SetDimming">
+ <arg type="b" direction="in" name="enable"/>
+ </method>
+
+ <!--
+ SetAutoBrightnessTarget:
+ @luminance: the target brightness
+
+ This lets the auto brightness system tell the shell what the ideal
+ relative brightness [0,1] is.
+ -->
+ <method name="SetAutoBrightnessTarget">
+ <arg type="d" direction="in" name="target"/>
+ </method>
+
+ <!--
+ HasBrightnessControl:
+ If any display has brightness control.
+ -->
+ <property name="HasBrightnessControl" type="b" access="read"/>
+
+ </interface>
+</node>
<file preprocess="xml-stripblanks">org.gnome.SettingsDaemon.Power.Keyboard.xml</file>
<file preprocess="xml-stripblanks">org.gnome.SettingsDaemon.Rfkill.xml</file>
<file preprocess="xml-stripblanks">org.gnome.Shell.AudioDeviceSelection.xml</file>
+ <file preprocess="xml-stripblanks">org.gnome.Shell.Brightness.xml</file>
<file preprocess="xml-stripblanks">org.gnome.Shell.CalendarServer.xml</file>
<file preprocess="xml-stripblanks">org.gnome.Shell.ClocksIntegration.xml</file>
<file preprocess="xml-stripblanks">org.gnome.Shell.Extensions.xml</file>
export let timeLimitsManager = null;
export let timeLimitsDispatcher = null;
export let brightnessManager = null;
+export let brightnessDBus = null;
let _startDate;
let _defaultCssStylesheet = null;
timeLimitsDispatcher = new TimeLimitsManager.TimeLimitsDispatcher(timeLimitsManager);
brightnessManager = new BrightnessManager.BrightnessManager();
+ brightnessDBus = new ShellDBus.BrightnessDBus(brightnessManager);
global.connect('shutdown', () => {
// Block shutdown until the session history file has been written
const GnomeShellExtensionsIface = loadInterfaceXML('org.gnome.Shell.Extensions');
const ScreenSaverIface = loadInterfaceXML('org.gnome.ScreenSaver');
const ScreenTimeIface = loadInterfaceXML('org.gnome.Shell.ScreenTime');
+const BrightnessIface = loadInterfaceXML('org.gnome.Shell.Brightness');
export class GnomeShell {
constructor() {
return this._manager.lastBreakEndTime;
}
}
+
+export class BrightnessDBus {
+ constructor(brightnessManager) {
+ this._manager = brightnessManager;
+
+ this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(BrightnessIface, this);
+ this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell/Brightness');
+
+ Gio.DBus.session.own_name('org.gnome.Shell.Brightness',
+ Gio.BusNameOwnerFlags.NONE, null, null);
+
+ this._manager.connectObject('changed', this._sync.bind(this), this);
+ this._sync();
+ }
+
+ _sync() {
+ const hasBrightnessControl = !!this._manager.globalScale;
+ if (hasBrightnessControl === this._hasBrightnessControl)
+ return;
+
+ this._hasBrightnessControl = hasBrightnessControl;
+ this._dbusImpl.emit_property_changed('HasBrightnessControl',
+ new GLib.Variant('b', this._hasBrightnessControl));
+ }
+
+ SetDimming(enable) {
+ this._manager.dimming = enable;
+ }
+
+ SetAutoBrightnessTarget(target) {
+ this._manager.autoBrightnessTarget = target;
+ }
+
+ get HasBrightnessControl() {
+ return this._hasBrightnessControl;
+ }
+}